<#include "/main.ftl"/>
<@diamondNav/>
<body>

<div id="content" style="margin-left: 13%">
    <div style="margin-top: 5%;margin-left: 1%;width: 100%">
        
        <#if interfaceMock.interfaceMockId??>
            <form action="/interfaceMockController/updateInterfaceMock"
        <#else >
             <form action="/interfaceMockController/addInterfaceMock"
        </#if>
                   method="post" id="myForm" class="form-horizontal" >
        <div class="form-group">
            <label class="col-md-2 control-label" for="interfaceAliasName">接口mock别名</label>
            <div class="col-md-3">
                <input class="form-control" name="interfaceAliasName" type="text" id="interfaceAliasName"
                       placeholder="接口mock别名"
                       value="<#if interfaceMock?? && interfaceMock.interfaceAliasName ??>${interfaceMock.interfaceAliasName!}</#if>"/>
                 <#if interfaceMock??>
                     <@spring.bind "interfaceMock.interfaceAliasName" />
                     <span style="color: red"> <@spring.showErrors ""/> </span>
                 </#if>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label" for="interfaceName">
             <#if interfaceMock??>
                <#if interfaceMock.interfaceType =="dubbo">
                接口名称
                <#else >
                   url
                </#if>
             <#else >
                 url
             </#if></label>
            <div class="col-md-3">
                <input class="form-control" name="interfaceName" type="text" id="interfaceName" placeholder="接口名称"
                       value="<#if interfaceMock?? && interfaceMock.interfaceName ??>${interfaceMock.interfaceName!}</#if>"/>
                 <#if interfaceMock??>
                     <@spring.bind "interfaceMock.interfaceName" />
                     <span style="color: red"> <@spring.showErrors ""/> </span>
                 </#if>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label" for="interfaceMethod">mock方法</label>
            <div class="col-md-3">
               <#if  interfaceMock.interfaceType =="dubbo">
                   <input class="form-control" type="text" name="interfaceMethod" id="interfaceMethod"
                          value="<#if interfaceMock?? && interfaceMock.interfaceMethod ??>${interfaceMock.interfaceMethod!}</#if>">
               <#else >
                        <select class="form-control" title="" id="interfaceMethod" name="interfaceMethod">
                            <option value="GET" <#if interfaceMock.interfaceMethod?? && interfaceMock.interfaceMethod =="GET">selected="selected"</#if>>GET</option>
                            <option value="POST" <#if interfaceMock.interfaceMethod?? && interfaceMock.interfaceMethod =="POST">selected="selected"</#if>>POST</option>
                        </select>
               </#if>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label" for="ip">调用接口ip</label>
            <div class="col-md-3">
            <input class="form-control" name="ip" type="text" id="ip" placeholder="调用接口ip"
                   value="<#if interfaceMock?? && interfaceMock.ip ??>${interfaceMock.ip!}</#if>"/>
                 <#if interfaceMock??>
                     <@spring.bind "interfaceMock.ip" />
                     <span style="color: red"> <@spring.showErrors ""/> </span>
                 </#if>
            </div>
        </div>
        <#--<div class="form-group">-->
            <#--<label class="col-md-2 control-label" for="matchDataType">获取入参位置</label>-->
            <#--<div class="col-md-3">-->
            <#--<select class="form-control" title="" id="matchDataType" name="matchDataType">-->
                <#--<option value="noMatch" <#if interfaceMock.matchDataType?? && interfaceMock.matchDataType =="noMatch">selected="selected"</#if>>不匹配任何内容</option>-->
                <#--<option value="url" <#if interfaceMock.matchDataType?? && interfaceMock.matchDataType =="url">selected="selected"</#if>>url匹配</option>-->
                <#--<option value="body" <#if interfaceMock.matchDataType?? && interfaceMock.matchDataType =="body">selected="selected"</#if>>body匹配</option>-->
            <#--</select>-->
        <#--</div>-->
        <div class="form-group">
            <label class="col-md-2 control-label" for="matchType">入参匹配类型</label>
            <div class="col-md-3">
            <select class="form-control"  id="matchType" name="matchType">
                <option value="keyValue" <#if interfaceMock.matchType?? && interfaceMock.matchType =="keyValue">selected="selected"</#if>>url的keyValue</option>
                <option value="jsonPath" <#if interfaceMock.matchType?? && interfaceMock.matchType =="jsonPath">selected="selected"</#if>>jsonPath</option>
                <option value="xPath" <#if interfaceMock.matchType?? && interfaceMock.matchType =="xPath">selected="selected"</#if>>xPath</option>
                <option value="regexp" <#if interfaceMock.matchType?? && interfaceMock.matchType =="regexp">selected="selected"</#if>>正则表达式</option>
                <option value="custom" <#if interfaceMock.matchType?? && interfaceMock.matchType =="custom">selected="selected"</#if>>自定义脚本</option>
                <option value="noMatch" <#if interfaceMock.matchType?? && interfaceMock.matchType =="noMatch">selected="selected"</#if>>无匹配方式</option>
            </select>
        </div>
        </div>
        <div>
            <input id="interfaceType" name="interfaceType" type="hidden"
                   value="<#if interfaceMock?? && interfaceMock.interfaceType ??>${interfaceMock.interfaceType!}</#if>">
            <input name="interfaceMockId" type="hidden"
                   value="<#if interfaceMock?? && interfaceMock.interfaceMockId ??>${interfaceMock.interfaceMockId!}</#if>">
            <input name="projectId" type="hidden"
            value="<#if interfaceMock?? && interfaceMock.projectId ??>${interfaceMock.projectId!}</#if>">
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <button type="button" class="btn btn-success " id="back">
                    返回
                </button>
                <button type="reset" class="btn btn-success ">
                    重置
                </button>
                <button type="submit" class="btn btn-success">
                    提交
                </button>
            </div>
        </div>
    </form>
    </div>
</div>
</body>

<script type="text/javascript">
    $("#back").click(function(){
        window.location.href="/interfaceMockController/interfaceMockPage";
    })
</script>